<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SWAP Instruction</title>
<link href="../edit68k.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1 class="heading">SWAP Instruction<BR></h1>
<hr noshade></h1>
          <BR>
          <span class="text">The instruction SWAP swaps the upper word with the lower word in a data register (bit 31-16 is exchanged with bit 15-0).<BR>
          <BR>
  ADDRESS METHODS: Dn<BR>
  <BR>
  DATA LENGTH: Word</span></P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="54%">
  <TBODY>
    <TR>
      <TD width="19%" rowSpan=5 vAlign=top class="text">FLAGS:</TD>
      <TD width="81%" class="text">X - U</TD>
    </TR>
    <TR>
      <TD width="81%" class="text">N - Same as bit 31 in the data register</TD>
    </TR>
    <TR>
      <TD width="81%" class="text">Z - Set if all 32 bits are zero, else cleared</TD>
    </TR>
    <TR>
      <TD width="81%" class="text">C - 0</TD>
    </TR>
    <TR>
      <TD width="81%" class="text">V - 0</TD>
    </TR>
  </TBODY>
</TABLE>
<P><span class="text">SYNTAX: SWAP Dn</span></P>
<P><span class="text">EXAMPLE CODE:&nbsp;&nbsp;&nbsp; </span></P>
<P class="sourcecode"><span class="text">&nbsp;&nbsp;&nbsp; SWAP D0&nbsp;&nbsp;&nbsp; 
 
if D0 contains FFFF0000, it would become 0000FFFF, which is useful for packing 
and unpacking BCDs<BR>
</span></P>
</body>
</html>